package com.ruiysoft.service.order.consts;

/**
 * Date : 2018/11/10
 *
 * @author WenJialu
 */
/*public enum OrderCustomerStatusEnum {

	ORDER_CREATE(1, "订单生成，待用户确认"),
	CUSTOMER_CONFIRMED_WAITING_FOR_PAYMENT(2, "待用户付款"),
	CUSTOMER_PAID_WAITING_FOR_PLATFORM_CONFIRM(3, "用户已付款 待商铺确认"),
	SHOP_CONFIRMED_WATTING_FOR_DELIVER(5, "商铺确认付款 待发货"),
	DELIVERED(6, "已发货"),
	RECEIVED(7, "已收货"),
	BARTER_WAITING_FOR_SHOP_CONFIRM(11, "申请换货 待商铺确认"),
	BARTER_SHOP_CONFIRMED(12, "商铺确认换货"),
	RETURNED_PURCHASE_WATING_FOR_SHOP_CONFIRM(21, "申请退货 待商铺确认"),
	RETURNED_PURCHASE_CONFIRMED_WATING_FOR_REFUND(22, "商铺确认退货 待退款"),
	REFUNDED(23, "已退款"),
	ORDER_CANCELLED(97, "订单取消"),
	ORDER_CLOSED(98, "订单关闭"),
	ORDER_OVER(99, "订单完结"),
	;

	private Integer code;
	private String text;

	OrderCustomerStatusEnum(Integer code, String text) {
		this.code = code;
		this.text = text;
	}

	private static Map<Integer, OrderCustomerStatusEnum> typeEnumMap = null;
	private static Map<OrderCustomerStatusEnum, Set<OrderDBStatusEnum>> cus2DBStatusMap = new HashMap<>();

	public static Set<OrderDBStatusEnum> getDBStatusByCusStatus(Integer code) {
		OrderCustomerStatusEnum instance = getInstanceByCode(code);
		Set<OrderDBStatusEnum> dbStatus = cus2DBStatusMap.get(instance);
		if (null == dbStatus) {
			dbStatus = getDBStatusByCusStatus(instance);
			cus2DBStatusMap.put(instance, dbStatus);
		}
		return dbStatus;
	}


	public static OrderCustomerStatusEnum getCusStatusByDBStatus(Integer code) {
		OrderDBStatusEnum instance = OrderDBStatusEnum.getInstanceByCode(code);
		switch (instance) {
			case ORDER_CREATE_WAITING_FOR_CUSTOMER_CONFIRM:
				return ORDER_CREATE;
			case CUSTOMER_CONFIRMED_WAITING_FOR_PAYMENT:
				return CUSTOMER_CONFIRMED_WAITING_FOR_PAYMENT;
			case CUSTOMER_PAID_WAITING_FOR_PLATFORM_CONFIRM:
			case PLATFORM_CONFIRMED_WAITING_FOR_SHOP_CONFIRM:
			case SHOP_CONFIRMED_WATTING_FOR_DELIVER:
				return SHOP_CONFIRMED_WATTING_FOR_DELIVER;
			case DELIVERED:
				return DELIVERED;
			case RECEIVED:
			case SYSTEM_SIGNED:
				return RECEIVED;
			case BARTER_WAITING_FOR_SHOP_CONFIRM:
				return BARTER_WAITING_FOR_SHOP_CONFIRM;
			case BARTER_SHOP_CONFIRMED:
				return BARTER_SHOP_CONFIRMED;
			case RETURNED_PURCHASE_WATING_FOR_SHOP_CONFIRM:
				return RETURNED_PURCHASE_WATING_FOR_SHOP_CONFIRM;
			case RETURNED_PURCHASE_CONFIRMED_WATING_FOR_REFUND:
				return RETURNED_PURCHASE_CONFIRMED_WATING_FOR_REFUND;
			case REFUNDED:
				return REFUNDED;
			case ORDER_CANCELLED:
				return ORDER_CANCELLED;
			case ORDER_CLOSED:
				return ORDER_CLOSED;
			case ORDER_OVER:
				return ORDER_OVER;
			default:
				return null;
		}
	}

	public static OrderCustomerStatusEnum getInstanceByCode(Integer code) {
		if (null == typeEnumMap) {
			typeEnumMap = Arrays.stream(OrderCustomerStatusEnum.values()).collect(Collectors.toMap(OrderCustomerStatusEnum::getCode, typeEnum -> typeEnum));
		}
		return typeEnumMap.get(code);
	}

	private static Set<OrderDBStatusEnum> getDBStatusByCusStatus(OrderCustomerStatusEnum instance) {
		switch (instance) {
			case ORDER_CREATE:
				return Collections.singleton(OrderDBStatusEnum.ORDER_CREATE_WAITING_FOR_CUSTOMER_CONFIRM);
			case CUSTOMER_CONFIRMED_WAITING_FOR_PAYMENT:
				return Collections.singleton(OrderDBStatusEnum.CUSTOMER_CONFIRMED_WAITING_FOR_PAYMENT);
			case SHOP_CONFIRMED_WATTING_FOR_DELIVER:
				return new HashSet<>(Arrays.asList(OrderDBStatusEnum.CUSTOMER_PAID_WAITING_FOR_PLATFORM_CONFIRM,
						OrderDBStatusEnum.PLATFORM_CONFIRMED_WAITING_FOR_SHOP_CONFIRM,
						OrderDBStatusEnum.SHOP_CONFIRMED_WATTING_FOR_DELIVER));
			case DELIVERED:
				return Collections.singleton(OrderDBStatusEnum.DELIVERED);
			case RECEIVED:
				return new HashSet<>(Arrays.asList(OrderDBStatusEnum.RECEIVED,
						OrderDBStatusEnum.SYSTEM_SIGNED));
			case BARTER_WAITING_FOR_SHOP_CONFIRM:
				return Collections.singleton(OrderDBStatusEnum.BARTER_WAITING_FOR_SHOP_CONFIRM);
			case BARTER_SHOP_CONFIRMED:
				return Collections.singleton(OrderDBStatusEnum.BARTER_SHOP_CONFIRMED);
			case RETURNED_PURCHASE_WATING_FOR_SHOP_CONFIRM:
				return Collections.singleton(OrderDBStatusEnum.RETURNED_PURCHASE_WATING_FOR_SHOP_CONFIRM);
			case RETURNED_PURCHASE_CONFIRMED_WATING_FOR_REFUND:
				return Collections.singleton(OrderDBStatusEnum.RETURNED_PURCHASE_CONFIRMED_WATING_FOR_REFUND);
			case REFUNDED:
				return Collections.singleton(OrderDBStatusEnum.REFUNDED);
			case ORDER_CANCELLED:
				return Collections.singleton(OrderDBStatusEnum.ORDER_CANCELLED);
			case ORDER_CLOSED:
				return Collections.singleton(OrderDBStatusEnum.ORDER_CLOSED);
			case ORDER_OVER:
				return Collections.singleton(OrderDBStatusEnum.ORDER_OVER);
			default:
				return Collections.emptySet();
		}
	}


	public Integer getCode() {
		return code;
	}

	public String getText() {
		return text;
	}

}*/
